package com.lianjia.sh.se.message.event.client.listener;


import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.util.TypeUtils;
import com.lianjia.sh.se.Person;
import com.lianjia.sh.se.message.event.client.annotion.MessageEventListener;
import com.lianjia.sh.se.message.event.client.model.MessageEvent;
import org.springframework.stereotype.Component;

/**
 * Created by yangsp1 on 16/8/3.
 */
@Component
@MessageEventListener(projectCode = "fy",serviceCode = "event")
public class MyMessageEventListener extends AbstractMessageEventListener {
    @Override
    public void onMessage(MessageEvent messageEvent) {
        JSONObject data = (JSONObject)messageEvent.getData();
        Person person = TypeUtils.castToJavaBean(data, Person.class);
        System.out.println("project =======" + messageEvent.getProjectCode());
        System.out.println("person.name ===" + person.getName());
    }
}
